home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _36851340840745CAABBC96F4A35847C0 < prev    next >
Encoding:
Text File  |  2004-01-06  |  3.1 KB  |  86 lines

  1. --------------------------------------------------
  2. --    Created By: Petar
  3.  
  4.  
  5. AIBehaviour.MorphAttack = {
  6.     Name = "MorphAttack",
  7.  
  8.  
  9.     ---------------------------------------------
  10.     OnPlayerSeen = function( self, entity, fDistance )
  11.         -- called when the enemy sees a living player
  12.  
  13.         entity:SelectPipe(0,"morpher_attack_wrapper");
  14.         entity:InsertSubpipe(0,"DropBeaconAt");
  15.     end,
  16.     ---------------------------------------------
  17.     OnPlayerLookingAway =  function( self, entity, fDistance )
  18.         entity:GoRefractive();
  19. --        AI:Cloak(entity.id);
  20.         entity:SelectPipe(0,"morpher_invisible_attack");
  21.     end,
  22.  
  23.     ---------------------------------------------
  24.     OnEnemyMemory = function( self, entity )
  25.         -- called when the enemy can no longer see its foe, but remembers where it saw it last
  26.     end,
  27.     ---------------------------------------------
  28.     OnInterestingSoundHeard = function( self, entity )
  29.         -- called when the enemy hears an interesting sound
  30.     end,
  31.     ---------------------------------------------
  32.     OnThreateningSoundHeard = function( self, entity )
  33.         -- called when the enemy hears a scary sound
  34.     end,
  35.     ---------------------------------------------
  36.     OnReload = function( self, entity )
  37.         -- called when the enemy goes into automatic reload after its clip is empty
  38.     end,
  39.     ---------------------------------------------
  40.     OnGroupMemberDied = function( self, entity )
  41.         -- called when a member of the group dies
  42.     end,
  43.     ---------------------------------------------
  44.     OnNoHidingPlace = function( self, entity, sender )
  45.         -- called when no hiding place can be found with the specified parameters
  46.         entity:InsertSubpipe(0,"mutant_run_towards_target");
  47.     end,    
  48.     ---------------------------------------------
  49.     OnReceivingDamage = function ( self, entity, sender)
  50.         entity:MutantJump(AIAnchor.MUTANT_AIRDUCT);
  51. --        entity:InsertSubpipe(0,"setup_crouch");
  52.     end,
  53.     --------------------------------------------------
  54.     OnBulletRain = function ( self, entity, sender)
  55.         -- called when the enemy detects bullet trails around him
  56.     end,
  57.     --------------------------------------------------
  58.     OnCloseContact = function ( self, entity, sender)
  59.         entity:GoVisible();
  60.         entity:SelectPipe(0,"morpher_attack_wrapper");
  61.         if (entity.MELEE_ANIM_COUNT) then
  62.             local rnd = random(1,entity.MELEE_ANIM_COUNT);
  63.             local melee_anim_name = format("attack_melee%01d",rnd);
  64.             entity:InsertAnimationPipe(melee_anim_name,3);
  65.         else
  66.             Hud:AddMessage("==================UNACCEPTABLE ERROR====================");
  67.             Hud:AddMessage("Entity "..entity:GetName().." made melee attack but has no melee animations.");
  68.             Hud:AddMessage("==================UNACCEPTABLE ERROR====================");
  69.         end
  70.     end,
  71.     --------------------------------------------------
  72.  
  73.     
  74.     SELECT_MORPH_ATTACK = function ( self, entity, sender)
  75.         local rnd=random(1,3);
  76.         if (rnd==1) then 
  77.             entity:InsertSubpipe(0,"morpher_attack_left");
  78.         elseif (rnd==2) then 
  79.             entity:InsertSubpipe(0,"morpher_attack_right");
  80.         else
  81.             entity:InsertSubpipe(0,"morpher_attack_retreat");
  82.         end
  83.     end,
  84.     --------------------------------------------------
  85.  
  86. }